package com.dongdong.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbBrandMapper;
import com.dongdong.pojo.TbBrand;
import com.dongdong.pojo.TbBrandExample;
import com.dongdong.service.BrandService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Deacription TODO
 * @Author Lenovo
 * @Date 2020/12/9 19:46
 * @Version 1.0
 **/
@Component
@Service
public class BrandServiceImpl implements BrandService {

    @Resource
    private TbBrandMapper tbBrandMapper;

    @Override
    public List<TbBrand> getBrandList() {
        List<TbBrand> listTbBrands = tbBrandMapper.selectByExample(null);
        //PageHelper.startPage(1,5);
        return tbBrandMapper.selectByExample(new TbBrandExample());
    }


    @Override
    public int saveBrand(TbBrand tbBrand) {
        return tbBrandMapper.insertSelective(tbBrand);
    }

    @Override
    public TbBrand toBrandUpdate(Long id) {
        return tbBrandMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateBrandInfo(TbBrand tbBrand) {
        return tbBrandMapper.updateByPrimaryKeySelective(tbBrand);
    }

    @Override
    public int deleteBatch(Long[] ids) {
        return tbBrandMapper.deleteBatch(ids);
    }
}

